package br.cs.correspodente.janela;

import java.awt.Color;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFormattedTextField;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.border.EmptyBorder;
import javax.swing.border.LineBorder;
import javax.swing.border.TitledBorder;

import br.cs.correspodente.beans.Vendedor;
import br.cs.correspodente.model.VendedorModel;
import br.cs.correspodente.util.VendedorUtil;
import br.cs.correspondente.enuns.EnunErro;
import br.cs.correspondente.servicos.Servicos;
import br.cs.correspondente.servicos.Validador;
import br.cs.correspondente.servicos.Visao;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.text.ParseException;

public class Janela_Principal extends JFrame {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1017611242977377227L;
	private JPanel contentPane;
	private JTextField txtNomeVendedor;
	private JTextField textField_2;
	private JTextField textField_3;
	private JFormattedTextField jftTelContato;
	private JLabel lblNome_1;
	private JLabel lblEmail;
	private JLabel lblTelefoneParaContato;
	private JFormattedTextField jftTelContato1;
	private JFormattedTextField jftTelContato3;
	private JFormattedTextField jftTelContato4;
	private JFormattedTextField jftTelContato5;
	private JLabel lblErroNome;
	private JLabel lblErroEmail;
	private JLabel lblErroTel02;
	private JLabel lblErroTel01;
	private JButton btnAdd;
	private JLabel lblErroTel03;
	private JLabel lblErroTel04;
	private JLabel lblErroTel05;
	private JLabel lblErroTel06;
	private JLabel lblTelefone;
	private JLabel lblTelefone_1;
	private JLabel lblTelefone_4;
	private JLabel lblTelefone_3;
	private JLabel lblTelefone_2;
	private JFormattedTextField jftTelContato2;
	private JPanel painel_CadastroImoveis;
	private JTextField txtCNPJVendedor;
	private JTextField txtEnpreendimentoVendedor;
	private JFormattedTextField jftTelefoneVendedor3;
	private JLabel lblTelefoneVendedor3;
	private JLabel lblTelefoneVendedor4;
	private JFormattedTextField jftTelefoneVendedor4;
	private JLabel lblNome;
	private JLabel lblCpf;
	private JFormattedTextField jftCPFVendedor;
	private JLabel lblCnpj;
	private JLabel lblEnpreendimento;
	private JLabel lblTelefoneVendedor;
	private JFormattedTextField jftTelefoneVendedor;
	private JButton btnAdd_Vendedor;
	private JLabel lblTelefoneVendedor2;
	private JFormattedTextField jftTelefoneVendedor2;
	private JTextField txtNomeVendedorImoveis;
	private JLabel lblEndereo;
	private JTextField txtEnderecoImovel;
	private JLabel lblCep;
	private JLabel lblNmero;
	private JLabel lblComplemento;
	private JLabel lblBairro;
	private JTextField txtBairroImovel;
	private JTextField txtNumeroImovel;
	private JTextField txtComplementoEndImovel;
	private JFormattedTextField txtCEPImovel;
	private JLabel lblValor;
	private JTextField txtValorImovel;
	private JLabel lblValorAvalidado;
	private JTextField txtValorAvaliadoImovel;
	private Vendedor vendedor;
	private JPanel painelLogo;
	private JPanel painel_CadastroVendedor;
	private JPanel painel_CadastroCliente;
	private JLabel lblErroCPFVendedor;
	private JLabel lblErroCNPJVendedor;
	private JLabel lblErroNomeEnpreendimentoVendedor;
	private JLabel lblErroTelVendedor;
	private JLabel lblErroTelVendedor02;
	private JLabel lblErroTelVendedor03;
	private JLabel lblErroTelVendedor04;
	private JButton btnRemover;
	private JLabel lblErroNomeVendedor;



	public Vendedor getVendedor() {
		return vendedor;
	}



	public void setVendedor(Vendedor vendedor) {
		this.vendedor = vendedor;
	}



	/**
	 * Create the frame.
	 */
	public Janela_Principal() {
		setTitle("Correspondente");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 880, 653);

		JMenuBar menuBar = new JMenuBar();
		setJMenuBar(menuBar);

		JMenu mnCliente = new JMenu("Cliente");
		mnCliente.setIcon(new ImageIcon(Janela_Principal.class.getResource("/br/cs/correspodente/resorces/iconUsuario.png")));
		menuBar.add(mnCliente);

		JMenuItem mntmMarcarEntrevista = new JMenuItem("Marcar Entrevista");
		mntmMarcarEntrevista.setIcon(new ImageIcon(Janela_Principal.class.getResource("/br/cs/correspodente/resorces/entrevista.png")));
		mntmMarcarEntrevista.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				limpaAllCampo();
				setAmbienteCadastro();
				painel_CadastroCliente.setVisible(true);
			}

		});
		mnCliente.add(mntmMarcarEntrevista);

		JMenuItem mntmCadastroDeCliente = new JMenuItem("Cadastro de Cliente");
		mntmCadastroDeCliente.setIcon(new ImageIcon(Janela_Principal.class.getResource("/br/cs/correspodente/resorces/iconAdicionar.png")));
		mnCliente.add(mntmCadastroDeCliente);

		JMenu mnVendedor = new JMenu("Vendedor");
		mnVendedor.setIcon(new ImageIcon(Janela_Principal.class.getResource("/br/cs/correspodente/resorces/iconAtendente.png")));
		menuBar.add(mnVendedor);

		JMenuItem mntmCadastrarVendedor = new JMenuItem("Cadastrar Vendedor");
		mntmCadastrarVendedor.setIcon(new ImageIcon(Janela_Principal.class.getResource("/br/cs/correspodente/resorces/iconAdicionar.png")));
		mntmCadastrarVendedor.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				limpaAllCampo();
				setAmbienteCadastro();
				painel_CadastroVendedor.setVisible(true);
			}
		});
		mnVendedor.add(mntmCadastrarVendedor);

		JMenu mnImovel = new JMenu("Imovel");
		mnImovel.setIcon(new ImageIcon(Janela_Principal.class.getResource("/br/cs/correspodente/resorces/imovel.png")));
		menuBar.add(mnImovel);

		JMenuItem mntmCadastrarImovel = new JMenuItem("Cadastrar Imovel");
		mntmCadastrarImovel.setIcon(new ImageIcon(Janela_Principal.class.getResource("/br/cs/correspodente/resorces/iconAdicionar.png")));
		mntmCadastrarImovel.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				limpaAllCampo();
				setAmbienteCadastro();
				painel_CadastroImoveis.setVisible(true);
			}
		});
		mnImovel.add(mntmCadastrarImovel);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);

		JLayeredPane layeredPane = new JLayeredPane();
		GroupLayout gl_contentPane = new GroupLayout(contentPane);
		gl_contentPane.setHorizontalGroup(
				gl_contentPane.createParallelGroup(Alignment.LEADING)
				.addComponent(layeredPane, GroupLayout.DEFAULT_SIZE, 782, Short.MAX_VALUE)
				);
		gl_contentPane.setVerticalGroup(
				gl_contentPane.createParallelGroup(Alignment.LEADING)
				.addComponent(layeredPane, GroupLayout.DEFAULT_SIZE, 540, Short.MAX_VALUE)
				);

		painel_CadastroCliente = new JPanel();
		painel_CadastroCliente.setBounds(0, 0, 862, 539);
		painel_CadastroCliente.setVisible(false);
		painel_CadastroCliente.setBorder(new TitledBorder(null, "Cadastro de Cliente", TitledBorder.LEADING, TitledBorder.TOP, null, null));

		lblNome_1 = new JLabel("Nome:");

		textField_2 = new JTextField();
		textField_2.setColumns(10);

		lblEmail = new JLabel("Email:");

		textField_3 = new JTextField();
		textField_3.setColumns(10);

		lblTelefoneParaContato = new JLabel("Telefone Para Contato");

		btnAdd = new JButton("Add +");
		btnAdd.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				if(!jftTelContato1.isVisible()){
					jftTelContato1.setVisible(true);
					lblTelefone.setVisible(true);
				}
				else if(!jftTelContato2.isVisible()){
					jftTelContato2.setVisible(true);
					lblTelefone_1.setVisible(true);

				}else if(!jftTelContato3.isVisible()){
					jftTelContato3.setVisible(true);
					lblTelefone_2.setVisible(true);

				}else if(!jftTelContato4.isVisible()){
					jftTelContato4.setVisible(true);
					lblTelefone_3.setVisible(true);

				}else if(!jftTelContato5.isVisible()){
					jftTelContato5.setVisible(true);
					lblTelefone_4.setVisible(true);
				}
			}
		});

		jftTelContato = new JFormattedTextField();

		jftTelContato1 = new JFormattedTextField();
		jftTelContato1.setVisible(false);

		jftTelContato2 = new JFormattedTextField();
		jftTelContato2.setVisible(false);

		jftTelContato3 = new JFormattedTextField();
		jftTelContato3.setVisible(false);

		jftTelContato4 = new JFormattedTextField();
		jftTelContato4.setVisible(false);

		jftTelContato5 = new JFormattedTextField();
		jftTelContato5.setVisible(false);

		lblTelefone = new JLabel("Telefone 2");
		lblTelefone.setVisible(false);

		lblTelefone_1 = new JLabel("Telefone 3");
		lblTelefone_1.setVisible(false);

		lblTelefone_2 = new JLabel("Telefone 4");
		lblTelefone_2.setVisible(false);

		lblTelefone_3 = new JLabel("Telefone5");
		lblTelefone_3.setVisible(false);

		lblTelefone_4 = new JLabel("Telefone 6");
		lblTelefone_4.setVisible(false);
		painelLogo = new JPanel();
		painelLogo.setBounds(0, 0, 621, 392);

		JLabel label = new JLabel("");
		label.setIcon(new ImageIcon(Janela_Principal.class.getResource("/br/cs/correspodente/resorces/logoWS.png")));

		lblErroNomeVendedor = new JLabel("");

		lblErroNome = new JLabel("");

		lblErroEmail = new JLabel("");

		lblErroTel01 = new JLabel("");

		lblErroTel02 = new JLabel("");

		lblErroTel03 = new JLabel("");
		lblErroTel03.setHorizontalAlignment(SwingConstants.LEFT);

		lblErroTel04 = new JLabel("");

		lblErroTel05 = new JLabel("");

		lblErroTel06 = new JLabel("");

		JPanel panel_1 = new JPanel();
		panel_1.setBorder(UIManager.getBorder("TitledBorder.border"));
		GroupLayout gl_painel_CadastroCliente = new GroupLayout(painel_CadastroCliente);
		gl_painel_CadastroCliente.setHorizontalGroup(
				gl_painel_CadastroCliente.createParallelGroup(Alignment.TRAILING)
				.addGroup(gl_painel_CadastroCliente.createSequentialGroup()
						.addGap(193)
						.addGroup(gl_painel_CadastroCliente.createParallelGroup(Alignment.LEADING, false)
								.addGroup(gl_painel_CadastroCliente.createSequentialGroup()
										.addComponent(lblNome_1)
										.addPreferredGap(ComponentPlacement.UNRELATED)
										.addComponent(textField_2, GroupLayout.PREFERRED_SIZE, 260, GroupLayout.PREFERRED_SIZE))
										.addGroup(gl_painel_CadastroCliente.createSequentialGroup()
												.addComponent(lblEmail)
												.addPreferredGap(ComponentPlacement.UNRELATED)
												.addComponent(textField_3, GroupLayout.PREFERRED_SIZE, 262, GroupLayout.PREFERRED_SIZE))
												.addGroup(gl_painel_CadastroCliente.createSequentialGroup()
														.addGroup(gl_painel_CadastroCliente.createParallelGroup(Alignment.TRAILING)
																.addComponent(lblTelefone_4)
																.addComponent(lblTelefone_3)
																.addComponent(lblTelefone_2)
																.addComponent(lblTelefone_1)
																.addComponent(lblTelefone)
																.addComponent(lblTelefoneParaContato))
																.addPreferredGap(ComponentPlacement.UNRELATED)
																.addGroup(gl_painel_CadastroCliente.createParallelGroup(Alignment.LEADING)
																		.addComponent(jftTelContato1, GroupLayout.PREFERRED_SIZE, 174, GroupLayout.PREFERRED_SIZE)
																		.addComponent(jftTelContato, GroupLayout.PREFERRED_SIZE, 174, GroupLayout.PREFERRED_SIZE)
																		.addComponent(jftTelContato2, GroupLayout.PREFERRED_SIZE, 174, GroupLayout.PREFERRED_SIZE)
																		.addComponent(jftTelContato3, GroupLayout.PREFERRED_SIZE, 174, GroupLayout.PREFERRED_SIZE)
																		.addComponent(jftTelContato4, GroupLayout.PREFERRED_SIZE, 174, GroupLayout.PREFERRED_SIZE)
																		.addComponent(jftTelContato5, GroupLayout.PREFERRED_SIZE, 174, GroupLayout.PREFERRED_SIZE))))
																		.addGroup(gl_painel_CadastroCliente.createParallelGroup(Alignment.LEADING)
																				.addGroup(gl_painel_CadastroCliente.createSequentialGroup()
																						.addPreferredGap(ComponentPlacement.RELATED)
																						.addComponent(lblErroNome))
																						.addGroup(gl_painel_CadastroCliente.createSequentialGroup()
																								.addPreferredGap(ComponentPlacement.RELATED)
																								.addComponent(lblErroEmail, GroupLayout.PREFERRED_SIZE, 16, GroupLayout.PREFERRED_SIZE))
																								.addGroup(gl_painel_CadastroCliente.createSequentialGroup()
																										.addGap(4)
																										.addGroup(gl_painel_CadastroCliente.createParallelGroup(Alignment.LEADING)
																												.addComponent(lblErroTel02, GroupLayout.PREFERRED_SIZE, 16, GroupLayout.PREFERRED_SIZE)
																												.addGroup(gl_painel_CadastroCliente.createSequentialGroup()
																														.addComponent(lblErroTel01, GroupLayout.PREFERRED_SIZE, 16, GroupLayout.PREFERRED_SIZE)
																														.addPreferredGap(ComponentPlacement.RELATED)
																														.addComponent(btnAdd))
																														.addComponent(lblErroTel03, GroupLayout.PREFERRED_SIZE, 16, GroupLayout.PREFERRED_SIZE)
																														.addComponent(lblErroTel04, GroupLayout.PREFERRED_SIZE, 16, GroupLayout.PREFERRED_SIZE)
																														.addComponent(lblErroTel05, GroupLayout.PREFERRED_SIZE, 16, GroupLayout.PREFERRED_SIZE)
																														.addComponent(lblErroTel06, GroupLayout.PREFERRED_SIZE, 16, GroupLayout.PREFERRED_SIZE))))
																														.addContainerGap(193, Short.MAX_VALUE))
																														.addGroup(gl_painel_CadastroCliente.createSequentialGroup()
																																.addGap(135)
																																.addComponent(panel_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
																																.addContainerGap(135, Short.MAX_VALUE))
				);
		gl_painel_CadastroCliente.setVerticalGroup(
				gl_painel_CadastroCliente.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_painel_CadastroCliente.createSequentialGroup()
						.addGap(38)
						.addGroup(gl_painel_CadastroCliente.createParallelGroup(Alignment.LEADING)
								.addGroup(gl_painel_CadastroCliente.createSequentialGroup()
										.addGroup(gl_painel_CadastroCliente.createParallelGroup(Alignment.BASELINE)
												.addComponent(lblNome_1)
												.addComponent(textField_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
												.addPreferredGap(ComponentPlacement.UNRELATED)
												.addGroup(gl_painel_CadastroCliente.createParallelGroup(Alignment.BASELINE)
														.addComponent(lblEmail)
														.addComponent(textField_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
														.addComponent(lblErroEmail)))
														.addComponent(lblErroNome))
														.addGap(18)
														.addGroup(gl_painel_CadastroCliente.createParallelGroup(Alignment.BASELINE)
																.addComponent(lblTelefoneParaContato)
																.addComponent(jftTelContato, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
																.addComponent(btnAdd)
																.addComponent(lblErroTel01))
																.addGap(18)
																.addGroup(gl_painel_CadastroCliente.createParallelGroup(Alignment.BASELINE)
																		.addComponent(jftTelContato1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
																		.addComponent(lblTelefone)
																		.addComponent(lblErroTel02))
																		.addGap(18)
																		.addGroup(gl_painel_CadastroCliente.createParallelGroup(Alignment.LEADING)
																				.addGroup(gl_painel_CadastroCliente.createSequentialGroup()
																						.addGroup(gl_painel_CadastroCliente.createParallelGroup(Alignment.BASELINE)
																								.addComponent(jftTelContato2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
																								.addComponent(lblTelefone_1))
																								.addGap(18)
																								.addGroup(gl_painel_CadastroCliente.createParallelGroup(Alignment.BASELINE)
																										.addComponent(jftTelContato3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
																										.addComponent(lblTelefone_2)
																										.addComponent(lblErroTel04))
																										.addGap(18)
																										.addGroup(gl_painel_CadastroCliente.createParallelGroup(Alignment.BASELINE)
																												.addComponent(jftTelContato4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
																												.addComponent(lblTelefone_3)
																												.addComponent(lblErroTel05))
																												.addGap(18)
																												.addGroup(gl_painel_CadastroCliente.createParallelGroup(Alignment.BASELINE)
																														.addComponent(jftTelContato5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
																														.addComponent(lblTelefone_4)
																														.addComponent(lblErroTel06)))
																														.addComponent(lblErroTel03))
																														.addPreferredGap(ComponentPlacement.RELATED, 7, Short.MAX_VALUE)
																														.addComponent(panel_1, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE)
																														.addGap(38))
				);
		gl_painel_CadastroCliente.linkSize(SwingConstants.HORIZONTAL, new Component[] {textField_2, textField_3});

		JButton btnMarcaEntrevista = new JButton("Marca Entrevista");
		btnMarcaEntrevista.setIcon(new ImageIcon(Janela_Principal.class.getResource("/br/cs/correspodente/resorces/iconSalvar.png")));

		JButton btnLimpar = new JButton("Limpar");
		btnLimpar.setIcon(new ImageIcon(Janela_Principal.class.getResource("/br/cs/correspodente/resorces/iconLimpar.png")));

		JButton btnCancelar = new JButton("Cancelar");
		btnCancelar.setIcon(new ImageIcon(Janela_Principal.class.getResource("/br/cs/correspodente/resorces/iconCancelar.png")));
		GroupLayout gl_panel_1 = new GroupLayout(panel_1);
		gl_panel_1.setHorizontalGroup(
				gl_panel_1.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_panel_1.createSequentialGroup()
						.addContainerGap()
						.addComponent(btnMarcaEntrevista)
						.addPreferredGap(ComponentPlacement.UNRELATED)
						.addComponent(btnLimpar)
						.addPreferredGap(ComponentPlacement.RELATED)
						.addComponent(btnCancelar)
						.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
				);
		gl_panel_1.setVerticalGroup(
				gl_panel_1.createParallelGroup(Alignment.LEADING)
				.addGroup(Alignment.TRAILING, gl_panel_1.createSequentialGroup()
						.addContainerGap(20, Short.MAX_VALUE)
						.addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE)
								.addComponent(btnMarcaEntrevista)
								.addComponent(btnLimpar)
								.addComponent(btnCancelar))
								.addGap(14))
				);
		gl_panel_1.linkSize(SwingConstants.VERTICAL, new Component[] {btnMarcaEntrevista, btnLimpar, btnCancelar});
		gl_panel_1.linkSize(SwingConstants.HORIZONTAL, new Component[] {btnMarcaEntrevista, btnLimpar, btnCancelar});
		panel_1.setLayout(gl_panel_1);
		painel_CadastroCliente.setLayout(gl_painel_CadastroCliente);
		GroupLayout gl_painelLogo = new GroupLayout(painelLogo);
		gl_painelLogo.setHorizontalGroup(
				gl_painelLogo.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_painelLogo.createSequentialGroup()
						.addGap(241)
						.addComponent(label, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
				);
		gl_painelLogo.setVerticalGroup(
				gl_painelLogo.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_painelLogo.createSequentialGroup()
						.addGap(92)
						.addComponent(label, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
				);
		painelLogo.setLayout(gl_painelLogo);
		layeredPane.setLayout(null);

		painel_CadastroVendedor = new JPanel();
		painel_CadastroVendedor.setBounds(0, 0, 862, 539);
		painel_CadastroVendedor.setVisible(false);
		painel_CadastroVendedor.setBorder(new TitledBorder(null, "Cadastro de Vendedor", TitledBorder.LEADING, TitledBorder.TOP, null, null));

		lblNome = new JLabel("Nome:");
		lblNome.setBounds(20, 69, 37, 16);

		txtNomeVendedor = new JTextField();
		txtNomeVendedor.setBounds(63, 63, 261, 28);
		txtNomeVendedor.addKeyListener(new KeyAdapter() {
			@Override
			public void keyReleased(KeyEvent arg0) {
				if(!Validador.isString(txtNomeVendedor.getText())){
					lblErroNomeVendedor.setIcon(new ImageIcon(Janela_Principal.class.getResource(EnunErro.ERROIMG.getDesc())));
					txtNomeVendedor.setForeground(Color.RED);
				}
				else{
					lblErroNomeVendedor.setIcon(new ImageIcon(Janela_Principal.class.getResource(EnunErro.CERTOIMG.getDesc())));
					txtNomeVendedor.setForeground(Color.BLUE);
				}

			}
		});
		txtNomeVendedor.setColumns(10);

		lblCpf = new JLabel("CPF:");
		lblCpf.setBounds(20, 115, 27, 16);

		lblCnpj = new JLabel("CNPJ:");
		lblCnpj.setBounds(20, 161, 35, 16);

		lblEnpreendimento = new JLabel("Enpreendimento:");
		lblEnpreendimento.setBounds(20, 207, 95, 16);

		lblTelefoneVendedor = new JLabel("Telefone:");
		lblTelefoneVendedor.setBounds(20, 253, 51, 16);

		jftCPFVendedor = new JFormattedTextField();
		jftCPFVendedor.addKeyListener(new KeyAdapter() {
			@Override
			public void keyReleased(KeyEvent arg0) {
				if(!Validador.isCpf(jftCPFVendedor.getText())){
					lblErroCPFVendedor.setIcon(new ImageIcon(Janela_Principal.class.getResource(EnunErro.ERROIMG.getDesc())));
					jftCPFVendedor.setForeground(Color.RED);
				}
				else{
					lblErroCPFVendedor.setIcon(new ImageIcon(Janela_Principal.class.getResource(EnunErro.CERTOIMG.getDesc())));
					jftCPFVendedor.setForeground(Color.BLUE);
				}

			}
		});
		jftCPFVendedor.setBounds(65, 109, 109, 28);
		try {
			jftCPFVendedor.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("###.###.###-##")));
		} catch (ParseException e1) {
			e1.printStackTrace();
		}
		txtCNPJVendedor = new JTextField();
		txtCNPJVendedor.addKeyListener(new KeyAdapter() {
			@Override
			public void keyReleased(KeyEvent arg0) {
				if(!Validador.isString(txtCNPJVendedor.getText())){
					lblErroCNPJVendedor.setIcon(new ImageIcon(Janela_Principal.class.getResource(EnunErro.ERROIMG.getDesc())));
					txtCNPJVendedor.setForeground(Color.RED);
				}
				else{
					lblErroCNPJVendedor.setIcon(new ImageIcon(Janela_Principal.class.getResource(EnunErro.CERTOIMG.getDesc())));
					txtCNPJVendedor.setForeground(Color.BLUE);
				}
			}
		});
		txtCNPJVendedor.setBounds(67, 155, 159, 28);
		txtCNPJVendedor.setForeground(Color.BLACK);
		txtCNPJVendedor.setColumns(10);

		txtEnpreendimentoVendedor = new JTextField();
		txtEnpreendimentoVendedor.addKeyListener(new KeyAdapter() {
			@Override
			public void keyReleased(KeyEvent arg0) {
				if(!Validador.isString(txtEnpreendimentoVendedor.getText())){
					lblErroNomeEnpreendimentoVendedor.setIcon(new ImageIcon(Janela_Principal.class.getResource(EnunErro.ERROIMG.getDesc())));
					txtEnpreendimentoVendedor.setForeground(Color.RED);
				}
				else{
					lblErroNomeEnpreendimentoVendedor.setIcon(new ImageIcon(Janela_Principal.class.getResource(EnunErro.CERTOIMG.getDesc())));
					txtEnpreendimentoVendedor.setForeground(Color.BLUE);
				}
			}
		});
		txtEnpreendimentoVendedor.setBounds(133, 201, 191, 28);
		txtEnpreendimentoVendedor.setColumns(10);

		jftTelefoneVendedor = new JFormattedTextField();
		jftTelefoneVendedor.addKeyListener(new KeyAdapter() {
			@Override
			public void keyReleased(KeyEvent arg0) {
				if(!Validador.isTelContato(jftTelefoneVendedor.getText())){
					lblErroTelVendedor.setIcon(new ImageIcon(Janela_Principal.class.getResource(EnunErro.ERROIMG.getDesc())));
					jftTelefoneVendedor.setForeground(Color.RED);
				}
				else{
					lblErroTelVendedor.setIcon(new ImageIcon(Janela_Principal.class.getResource(EnunErro.CERTOIMG.getDesc())));
					jftTelefoneVendedor.setForeground(Color.BLUE);
				}
			}
		});
		jftTelefoneVendedor.setBounds(101, 247, 111, 28);
		try {
			jftTelefoneVendedor.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("(##) ####-####")));
		} catch (ParseException e) {
			e.printStackTrace();
		}

		btnAdd_Vendedor = new JButton("Add+");
		btnAdd_Vendedor.setBounds(240, 247, 56, 28);
		btnAdd_Vendedor.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				if(!jftTelefoneVendedor2.isVisible()){
					jftTelefoneVendedor2.setVisible(true);
					lblTelefoneVendedor2.setVisible(true);
					lblErroTelVendedor02.setVisible(true);
				}else if(!jftTelefoneVendedor3.isVisible()){
					jftTelefoneVendedor3.setVisible(true);
					lblTelefoneVendedor3.setVisible(true);
					lblErroTelVendedor03.setVisible(true);
				}else if(!jftTelefoneVendedor4.isVisible()){
					jftTelefoneVendedor4.setVisible(true);
					lblTelefoneVendedor4.setVisible(true);
					lblErroTelVendedor04.setVisible(true);
				}
			}
		});

		lblTelefoneVendedor2 = new JLabel("Telefone 2:");
		lblTelefoneVendedor2.setBounds(20, 299, 61, 16);
		lblTelefoneVendedor2.setVisible(false);

		jftTelefoneVendedor2 = new JFormattedTextField();
		jftTelefoneVendedor2.addKeyListener(new KeyAdapter() {
			@Override
			public void keyReleased(KeyEvent arg0) {
				if(!Validador.isTelContato(jftTelefoneVendedor2.getText())){
					lblErroTelVendedor02.setIcon(new ImageIcon(Janela_Principal.class.getResource(EnunErro.ERROIMG.getDesc())));
					jftTelefoneVendedor2.setForeground(Color.RED);
				}
				else{
					lblErroTelVendedor02.setIcon(new ImageIcon(Janela_Principal.class.getResource(EnunErro.CERTOIMG.getDesc())));
					jftTelefoneVendedor2.setForeground(Color.BLUE);
				}
			}
		});
		jftTelefoneVendedor2.setBounds(105, 293, 111, 28);
		jftTelefoneVendedor2.setVisible(false);

		jftTelefoneVendedor3 = new JFormattedTextField();
		jftTelefoneVendedor3.addKeyListener(new KeyAdapter() {
			@Override
			public void keyReleased(KeyEvent arg0) {
				if(!Validador.isTelContato(jftTelefoneVendedor3.getText())){
					lblErroTelVendedor03.setIcon(new ImageIcon(Janela_Principal.class.getResource(EnunErro.ERROIMG.getDesc())));
					jftTelefoneVendedor3.setForeground(Color.RED);
				}
				else{
					lblErroTelVendedor03.setIcon(new ImageIcon(Janela_Principal.class.getResource(EnunErro.CERTOIMG.getDesc())));
					jftTelefoneVendedor3.setForeground(Color.BLUE);
				}
			}
		});
		jftTelefoneVendedor3.setBounds(105, 339, 111, 28);
		jftTelefoneVendedor3.setVisible(false);

		lblTelefoneVendedor3 = new JLabel("Telefone 3:");
		lblTelefoneVendedor3.setBounds(20, 345, 79, 16);
		lblTelefoneVendedor3.setVisible(false);

		lblTelefoneVendedor4 = new JLabel("Telefone 4:");
		lblTelefoneVendedor4.setBounds(20, 391, 61, 16);
		lblTelefoneVendedor4.setVisible(false);

		jftTelefoneVendedor4 = new JFormattedTextField();
		jftTelefoneVendedor4.addKeyListener(new KeyAdapter() {
			@Override
			public void keyReleased(KeyEvent arg0) {
				if(!Validador.isTelContato(jftTelefoneVendedor4.getText())){
					lblErroTelVendedor04.setIcon(new ImageIcon(Janela_Principal.class.getResource(EnunErro.ERROIMG.getDesc())));
					jftTelefoneVendedor4.setForeground(Color.RED);
				}
				else{
					lblErroTelVendedor04.setIcon(new ImageIcon(Janela_Principal.class.getResource(EnunErro.CERTOIMG.getDesc())));
					jftTelefoneVendedor4.setForeground(Color.BLUE);
				}
			}
		});
		jftTelefoneVendedor4.setBounds(105, 385, 111, 28);
		jftTelefoneVendedor4.setVisible(false);

		try {
			jftTelefoneVendedor2.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("(##) ####-####")));
			jftTelefoneVendedor3.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("(##) ####-####")));
			jftTelefoneVendedor4.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("(##) ####-####")));
		} catch (ParseException e) {

			e.printStackTrace();
		}


		JPanel panel = new JPanel();
		panel.setBounds(219, 444, 512, 81);
		panel.setBorder(UIManager.getBorder("TitledBorder.border"));

		JButton btnCadastrarVendedor = new JButton("Cadastrar");
		btnCadastrarVendedor.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				if(!Validador.validaCadastroVendedor(txtNomeVendedor.getText(),
						txtCNPJVendedor.getText(),
						txtEnpreendimentoVendedor.getText(),
						jftCPFVendedor.getText(),
						jftTelefoneVendedor.getText(),
						jftTelefoneVendedor2.getText(),
						jftTelefoneVendedor3.getText(),
						jftTelefoneVendedor4.getText())){
					Visao.showMsgErro("Cadastro invalido", "AVISO");
					return;
				}
				VendedorModel.cadastraVendeor(txtNomeVendedor.getText(),
						txtCNPJVendedor.getText(),
						txtEnpreendimentoVendedor.getText(),
						jftCPFVendedor.getText(),
						jftTelefoneVendedor.getText(),
						jftTelefoneVendedor2.getText(),
						jftTelefoneVendedor3.getText(),
						jftTelefoneVendedor4.getText());
			}

		});
		btnCadastrarVendedor.setIcon(new ImageIcon(Janela_Principal.class.getResource("/br/cs/correspodente/resorces/iconSalvar.png")));

		JButton btnLimparVendedor = new JButton("Limpar");
		btnLimparVendedor.setIcon(new ImageIcon(Janela_Principal.class.getResource("/br/cs/correspodente/resorces/iconLimpar.png")));

		JButton btnCancelarVendedor = new JButton("Cancelar");
		btnCancelarVendedor.setIcon(new ImageIcon(Janela_Principal.class.getResource("/br/cs/correspodente/resorces/iconCancelar.png")));
		GroupLayout gl_panel = new GroupLayout(panel);
		gl_panel.setHorizontalGroup(
				gl_panel.createParallelGroup(Alignment.LEADING)
				.addGroup(Alignment.TRAILING, gl_panel.createSequentialGroup()
						.addContainerGap(69, Short.MAX_VALUE)
						.addComponent(btnCadastrarVendedor)
						.addPreferredGap(ComponentPlacement.UNRELATED)
						.addComponent(btnLimparVendedor)
						.addPreferredGap(ComponentPlacement.RELATED)
						.addComponent(btnCancelarVendedor)
						.addGap(48))
				);
		gl_panel.setVerticalGroup(
				gl_panel.createParallelGroup(Alignment.TRAILING)
				.addGroup(Alignment.LEADING, gl_panel.createSequentialGroup()
						.addContainerGap()
						.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
								.addComponent(btnCadastrarVendedor)
								.addComponent(btnLimparVendedor)
								.addComponent(btnCancelarVendedor))
								.addContainerGap(14, Short.MAX_VALUE))
				);
		gl_panel.linkSize(SwingConstants.VERTICAL, new Component[] {btnCadastrarVendedor, btnLimparVendedor, btnCancelarVendedor});
		gl_panel.linkSize(SwingConstants.HORIZONTAL, new Component[] {btnCadastrarVendedor, btnLimparVendedor, btnCancelarVendedor});
		panel.setLayout(gl_panel);

		lblErroCPFVendedor = new JLabel("");
		lblErroCPFVendedor.setBounds(186, 109, 16, 22);

		lblErroCNPJVendedor = new JLabel("");
		lblErroCNPJVendedor.setBounds(238, 155, 16, 22);

		lblErroNomeEnpreendimentoVendedor = new JLabel("");
		lblErroNomeEnpreendimentoVendedor.setBounds(336, 201, 16, 22);

		lblErroTelVendedor = new JLabel("");
		lblErroTelVendedor.setBounds(218, 247, 16, 22);

		lblErroTelVendedor02 = new JLabel("");
		lblErroTelVendedor02.setBounds(218, 293, 16, 22);

		lblErroTelVendedor03 = new JLabel("");
		lblErroTelVendedor03.setBounds(218, 339, 16, 22);

		lblErroTelVendedor04 = new JLabel("");
		lblErroTelVendedor04.setBounds(218, 385, 16, 22);

		btnRemover = new JButton("Remover");
		btnRemover.setBounds(308, 247, 90, 28);
		btnRemover.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				if(jftTelefoneVendedor4.isVisible()){
					jftTelefoneVendedor4.setVisible(false);
					lblTelefoneVendedor4.setVisible(false);
					lblErroTelVendedor04.setVisible(false);
				}else if(jftTelefoneVendedor3.isVisible()){
					jftTelefoneVendedor3.setVisible(false);
					lblTelefoneVendedor3.setVisible(false);
					lblErroTelVendedor03.setVisible(false);
				}else if(jftTelefoneVendedor2.isVisible()){
					jftTelefoneVendedor2.setVisible(false);
					lblTelefoneVendedor2.setVisible(false);
					lblErroTelVendedor02.setVisible(false);
				}


			}
		});

		painel_CadastroImoveis = new JPanel();
		painel_CadastroImoveis.setBounds(0, 0, 862, 539);
		painel_CadastroImoveis.setVisible(false);
		painel_CadastroImoveis.setBorder(new TitledBorder(null, "Cadastro de Imoveis", TitledBorder.LEADING, TitledBorder.TOP, null, null));

		JLabel lblVendedor = new JLabel("Vendedor:");

		txtNomeVendedorImoveis = new JTextField();
		txtNomeVendedorImoveis.setEnabled(false);
		txtNomeVendedorImoveis.setEditable(false);
		txtNomeVendedorImoveis.setColumns(10);

		JButton btnBuscaVendedor = new JButton("");
		btnBuscaVendedor.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				DialogBuscaVendedor dialogBuscaVendedor = new DialogBuscaVendedor();
				dialogBuscaVendedor.setVisible(true);
				setVendedor(dialogBuscaVendedor.getVendedor());
				txtNomeVendedorImoveis.setText(getVendedor().getNome());
			}
		});
		btnBuscaVendedor.setBorder(null);
		btnBuscaVendedor.setIcon(new ImageIcon(Janela_Principal.class.getResource("/br/cs/correspodente/resorces/iconBuscarPequeno.png")));

		JPanel painelEndereco = new JPanel();
		painelEndereco.setBorder(new TitledBorder(new LineBorder(new Color(0, 0, 0)), "Endere\u00E7o:", TitledBorder.LEADING, TitledBorder.TOP, null, null));

		lblValor = new JLabel("Valor:");
		txtValorImovel = new JTextField();
		txtValorImovel.setColumns(10);
		txtValorImovel.addKeyListener(new KeyAdapter() {
			@Override
			public void keyReleased(KeyEvent e) {
				Servicos.apenasNumeros(txtValorImovel);
				if(!Validador.isValor(txtValorImovel.getText())){
					txtValorImovel.setForeground(Color.RED);
				}
				else{
					txtValorImovel.setForeground(Color.BLUE);
				}
			}
		});

		lblValorAvalidado = new JLabel("Valor Avalidado:");

		txtValorAvaliadoImovel = new JTextField();
		txtValorAvaliadoImovel.setColumns(10);
		txtValorAvaliadoImovel.addKeyListener(new KeyAdapter() {
			@Override
			public void keyReleased(KeyEvent e) {
				
				if(!Validador.isValor(txtValorAvaliadoImovel.getText())){
					txtValorAvaliadoImovel.setForeground(Color.RED);
				}
				else{
					txtValorAvaliadoImovel.setForeground(Color.BLUE);
				}
			}
		});

		JPanel painelOpcoesImovel = new JPanel();
		painelOpcoesImovel.setBorder(UIManager.getBorder("TitledBorder.border"));

		JButton btnCadastrarImovel = new JButton("Cadastrar");
		btnCadastrarImovel.setIcon(new ImageIcon(Janela_Principal.class.getResource("/br/cs/correspodente/resorces/iconSalvar.png")));
		btnCadastrarImovel.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				if(!Validador.isImovel(txtCEPImovel,txtComplementoEndImovel,txtNumeroImovel,txtBairroImovel,txtEnderecoImovel,txtValorImovel,txtValorAvaliadoImovel)){
					Visao.showMsgErro("Cadastro Invalido","Aviso");
					return;
				}
			}
		});

		JButton btnLimparImovel = new JButton("Limpar");
		btnLimparImovel.setIcon(new ImageIcon(Janela_Principal.class.getResource("/br/cs/correspodente/resorces/iconLimpar.png")));

		JButton btnCancelarImovel = new JButton("Cancelar");
		btnCancelarImovel.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
			}
		});
		btnCancelarImovel.setIcon(new ImageIcon(Janela_Principal.class.getResource("/br/cs/correspodente/resorces/iconCancelar.png")));
		GroupLayout gl_painelOpcoesImovel = new GroupLayout(painelOpcoesImovel);
		gl_painelOpcoesImovel.setHorizontalGroup(
				gl_painelOpcoesImovel.createParallelGroup(Alignment.TRAILING)
				.addGap(0, 512, Short.MAX_VALUE)
				.addGroup(gl_painelOpcoesImovel.createSequentialGroup()
						.addContainerGap(69, Short.MAX_VALUE)
						.addComponent(btnCadastrarImovel)
						.addPreferredGap(ComponentPlacement.UNRELATED)
						.addComponent(btnLimparImovel)
						.addPreferredGap(ComponentPlacement.RELATED)
						.addComponent(btnCancelarImovel)
						.addGap(48))
				);
		gl_painelOpcoesImovel.setVerticalGroup(
				gl_painelOpcoesImovel.createParallelGroup(Alignment.LEADING)
				.addGap(0, 81, Short.MAX_VALUE)
				.addGroup(gl_painelOpcoesImovel.createSequentialGroup()
						.addContainerGap()
						.addGroup(gl_painelOpcoesImovel.createParallelGroup(Alignment.BASELINE)
								.addComponent(btnCadastrarImovel)
								.addComponent(btnLimparImovel)
								.addComponent(btnCancelarImovel))
								.addContainerGap(11, Short.MAX_VALUE))
				);
		gl_painelOpcoesImovel.linkSize(SwingConstants.VERTICAL, new Component[] {btnCadastrarImovel, btnLimparImovel, btnCancelarImovel});
		gl_painelOpcoesImovel.linkSize(SwingConstants.HORIZONTAL, new Component[] {btnCadastrarImovel, btnLimparImovel, btnCancelarImovel});
		painelOpcoesImovel.setLayout(gl_painelOpcoesImovel);
		GroupLayout gl_painel_CadastroImoveis = new GroupLayout(painel_CadastroImoveis);
		gl_painel_CadastroImoveis.setHorizontalGroup(
				gl_painel_CadastroImoveis.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_painel_CadastroImoveis.createSequentialGroup()
						.addContainerGap()
						.addGroup(gl_painel_CadastroImoveis.createParallelGroup(Alignment.LEADING)
								.addComponent(painelEndereco, GroupLayout.PREFERRED_SIZE, 450, GroupLayout.PREFERRED_SIZE)
								.addGroup(gl_painel_CadastroImoveis.createSequentialGroup()
										.addComponent(lblVendedor)
										.addGap(18)
										.addComponent(txtNomeVendedorImoveis, GroupLayout.PREFERRED_SIZE, 233, GroupLayout.PREFERRED_SIZE)
										.addPreferredGap(ComponentPlacement.RELATED)
										.addComponent(btnBuscaVendedor, GroupLayout.PREFERRED_SIZE, 26, GroupLayout.PREFERRED_SIZE))
										.addGroup(gl_painel_CadastroImoveis.createSequentialGroup()
												.addComponent(lblValor)
												.addGap(18)
												.addComponent(txtValorImovel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
												.addGroup(gl_painel_CadastroImoveis.createSequentialGroup()
														.addComponent(lblValorAvalidado)
														.addGap(18)
														.addComponent(txtValorAvaliadoImovel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
														.addContainerGap(298, Short.MAX_VALUE))
														.addGroup(Alignment.TRAILING, gl_painel_CadastroImoveis.createSequentialGroup()
																.addContainerGap(135, Short.MAX_VALUE)
																.addComponent(painelOpcoesImovel, GroupLayout.PREFERRED_SIZE, 512, GroupLayout.PREFERRED_SIZE)
																.addGap(107))
				);
		gl_painel_CadastroImoveis.setVerticalGroup(
				gl_painel_CadastroImoveis.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_painel_CadastroImoveis.createSequentialGroup()
						.addGap(30)
						.addGroup(gl_painel_CadastroImoveis.createParallelGroup(Alignment.LEADING)
								.addComponent(btnBuscaVendedor, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE)
								.addGroup(gl_painel_CadastroImoveis.createParallelGroup(Alignment.BASELINE)
										.addComponent(lblVendedor)
										.addComponent(txtNomeVendedorImoveis, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
										.addGap(18)
										.addComponent(painelEndereco, GroupLayout.PREFERRED_SIZE, 202, GroupLayout.PREFERRED_SIZE)
										.addGap(24)
										.addGroup(gl_painel_CadastroImoveis.createParallelGroup(Alignment.BASELINE)
												.addComponent(lblValor)
												.addComponent(txtValorImovel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
												.addGap(18)
												.addGroup(gl_painel_CadastroImoveis.createParallelGroup(Alignment.BASELINE)
														.addComponent(lblValorAvalidado)
														.addComponent(txtValorAvaliadoImovel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
														.addPreferredGap(ComponentPlacement.RELATED, 45, Short.MAX_VALUE)
														.addComponent(painelOpcoesImovel, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE)
														.addContainerGap())
				);

		lblEndereo = new JLabel("Endere\u00E7o:");
		lblEndereo.setBounds(11, 30, 56, 16);
		
		txtEnderecoImovel = new JTextField();
		txtEnderecoImovel.setBounds(85, 24, 315, 28);
		txtEnderecoImovel.addKeyListener(new KeyAdapter() {
			@Override
			public void keyReleased(KeyEvent arg0) {
				if(!Validador.isString(txtEnderecoImovel.getText())){
					lblErroCPFVendedor.setIcon(new ImageIcon(Janela_Principal.class.getResource(EnunErro.ERROIMG.getDesc())));
					txtEnderecoImovel.setForeground(Color.RED);
				}
				else{
					lblErroCPFVendedor.setIcon(new ImageIcon(Janela_Principal.class.getResource(EnunErro.CERTOIMG.getDesc())));
					txtEnderecoImovel.setForeground(Color.BLUE);
				}
			}
		});
		txtEnderecoImovel.setColumns(10);

		lblCep = new JLabel("CEP:");
		lblCep.setBounds(11, 76, 28, 16);

		lblNmero = new JLabel("N\u00FAmero:");
		lblNmero.setBounds(11, 122, 48, 16);

		lblComplemento = new JLabel("Complemento:");
		lblComplemento.setBounds(11, 168, 82, 16);

		lblBairro = new JLabel("Bairro:");
		lblBairro.setBounds(186, 76, 36, 16);

		txtBairroImovel = new JTextField();
		txtBairroImovel.setBounds(240, 70, 160, 28);
		txtBairroImovel.setColumns(10);
		txtBairroImovel.addKeyListener(new KeyAdapter() {
			@Override
			public void keyReleased(KeyEvent e) {
				if(!Validador.isString(txtBairroImovel.getText())){
					txtBairroImovel.setForeground(Color.RED);
				}
				else{
					txtBairroImovel.setForeground(Color.BLUE);
				}
			}
		});

		txtNumeroImovel = new JTextField();
		txtNumeroImovel.setBounds(71, 116, 59, 28);
		txtNumeroImovel.setColumns(10);
		txtNumeroImovel.addKeyListener(new KeyAdapter() {
			@Override
			public void keyReleased(KeyEvent e) {
				if(!Validador.isString(txtNumeroImovel.getText())){
					txtNumeroImovel.setForeground(Color.RED);
				}
				else{
					txtNumeroImovel.setForeground(Color.BLUE);
				}
			}
		});
		
		txtComplementoEndImovel = new JTextField();
		txtComplementoEndImovel.setBounds(105, 162, 295, 28);
		txtComplementoEndImovel.setColumns(10);
		txtComplementoEndImovel.addKeyListener(new KeyAdapter() {
			@Override
			public void keyReleased(KeyEvent e) {
				if(!Validador.isString(txtComplementoEndImovel.getText())){
					txtComplementoEndImovel.setForeground(Color.RED);
				}
				else{
					txtComplementoEndImovel.setForeground(Color.BLUE);
				}
			}
		});

		txtCEPImovel = new JFormattedTextField();
		txtCEPImovel.setBounds(57, 70, 84, 28);
		txtCEPImovel.addKeyListener(new KeyAdapter() {
			@Override
			public void keyReleased(KeyEvent e) {
				if(!Validador.isCEP(txtCEPImovel.getText())){
					txtCEPImovel.setForeground(Color.RED);
				}
				else{
					txtCEPImovel.setForeground(Color.BLUE);
				}
			}
		});
		try {
			txtCEPImovel.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("#####-###")));
		} catch (ParseException e) {
			e.printStackTrace();
		}
		painelEndereco.setLayout(null);
		painelEndereco.add(lblComplemento);
		painelEndereco.add(txtComplementoEndImovel);
		painelEndereco.add(lblCep);
		painelEndereco.add(txtCEPImovel);
		painelEndereco.add(lblBairro);
		painelEndereco.add(txtBairroImovel);
		painelEndereco.add(lblEndereo);
		painelEndereco.add(txtEnderecoImovel);
		painelEndereco.add(lblNmero);
		painelEndereco.add(txtNumeroImovel);
		painel_CadastroImoveis.setLayout(gl_painel_CadastroImoveis);
		layeredPane.add(painel_CadastroImoveis);
		layeredPane.add(painel_CadastroVendedor);
		painel_CadastroVendedor.setLayout(null);
		painel_CadastroVendedor.add(lblNome);
		painel_CadastroVendedor.add(txtNomeVendedor);
		painel_CadastroVendedor.add(lblCpf);
		painel_CadastroVendedor.add(jftCPFVendedor);
		painel_CadastroVendedor.add(lblErroCPFVendedor);
		painel_CadastroVendedor.add(lblCnpj);
		painel_CadastroVendedor.add(txtCNPJVendedor);
		painel_CadastroVendedor.add(lblErroCNPJVendedor);
		painel_CadastroVendedor.add(lblEnpreendimento);
		painel_CadastroVendedor.add(txtEnpreendimentoVendedor);
		painel_CadastroVendedor.add(lblErroNomeEnpreendimentoVendedor);
		painel_CadastroVendedor.add(lblTelefoneVendedor);
		painel_CadastroVendedor.add(jftTelefoneVendedor);
		painel_CadastroVendedor.add(lblErroTelVendedor);
		painel_CadastroVendedor.add(btnAdd_Vendedor);
		painel_CadastroVendedor.add(btnRemover);
		painel_CadastroVendedor.add(lblTelefoneVendedor2);
		painel_CadastroVendedor.add(jftTelefoneVendedor2);
		painel_CadastroVendedor.add(lblErroTelVendedor02);
		painel_CadastroVendedor.add(lblTelefoneVendedor3);
		painel_CadastroVendedor.add(jftTelefoneVendedor3);
		painel_CadastroVendedor.add(lblErroTelVendedor03);
		painel_CadastroVendedor.add(lblTelefoneVendedor4);
		painel_CadastroVendedor.add(jftTelefoneVendedor4);
		painel_CadastroVendedor.add(lblErroTelVendedor04);
		painel_CadastroVendedor.add(panel);

		lblErroNomeVendedor = new JLabel("");
		lblErroNomeVendedor.setBounds(336, 69, 55, 16);
		painel_CadastroVendedor.add(lblErroNomeVendedor);
		layeredPane.add(painel_CadastroCliente);
		layeredPane.add(painelLogo);
		contentPane.setLayout(gl_contentPane);
	}
	public void limpaAllCampo(){

	}
	public void setAmbienteCadastro(){
		painelLogo.setVisible(false);
		painel_CadastroCliente.setVisible(false);
		painel_CadastroImoveis.setVisible(false);
		painel_CadastroVendedor.setVisible(false);
	}
}
